package spacegame.model;

import org.andengine.entity.sprite.Sprite;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.MassData;

import spacegame.interfaces.ISpaceObject;

public class PlanetItem implements ISpaceObject{

	private Sprite m_face;
	private Body m_body;
	private float m_x;
	private float m_y;
	private int m_mass;

	public PlanetItem(final float pX, final float pY, Sprite pFace, Body pBody, int pMass)
	{
		m_face = pFace;
		m_body = pBody;
		m_x = pX;
		m_y = pY;
		m_mass =pMass;
		final MassData data = pBody.getMassData();
		data.mass = pMass;
		data.I = pMass;
		pBody.setMassData(data);	
	}

	@Override
	public void Update(float pSecondsElapsed) {
		m_body.localPoint2.x = m_x;
		m_body.localPoint2.y = m_y;
		
	}
	
	
	public Vector2 GetPosition()
	{		
		return m_body.getWorldCenter();
	}

	public int GetMass() {
		return m_mass;
	}

}
